{extend name="public/base" /}

{block name="pjax_container"}
<?php
    $titleTypeName = '预览排名';
?>
<style>
    #com_department{
        border-radius: 6px;
    }
 
.timepicker{
    border: none;
    margin: 0 10px;
    line-height: 35px;
    text-align: center;
    border: 1px solid #ccc;

}
.content-header>.breadcrumb>li{
    color: #999;
}
.content-header>.breadcrumb>.active{
    color: #666;
}
.content-header{
    height: 51px;
 
}
.btn-primary{
      background-color: #1890FF;
    color: #fff;
    border: none;
    border-radius: 6px !important;
    margin-left: 15px;
    padding: 5px 10px; 
    line-height: 24px;
}
.box-primary{
  border-top-color: #ecf0f5 !important;
  border-top-width: 16px;
  
}
.btn-primary:hover{
     background-color: #1890FF;
    color: #fff;
    border: none;
    opacity: .9;
    border-radius: 6px !important; 
}
.delete-one{
    background-color: ff4141 !important;
    margin-left: 15px;
    border-radius: 6px;
}
.sreachs{
       background-color: #1890FF;
    color: #fff;
    border: none;
    border-radius: 6px !important;
    margin-left: 15px;
    padding: 7px 15px; 
    margin-right: 5px;
}
tr>th,td{
    text-align: center;
}
a{
    margin-right: 0 10px;
}


.magic-radio,
.magic-checkbox {
	position: absolute;
	display: none;
    
}
 

 
.magic-radio + label,
.magic-checkbox + label {
	position: relative;
	display: block;
	padding-left: 30px;
	cursor: pointer;
 
}
 
.magic-radio + label:before,
.magic-checkbox + label:before {
	position: absolute;
	top: 0px;
	left: 0;
	display: inline-block;
	width: 20px;
	height: 20px;
        margin-top: 5px;
	content: '';
	border: 1px solid #c0c0c0;
}
.magic-checkbox + label:before{
    	top: -5px;
}
.magic-radio + label:after,
  .magic-checkbox + label:after {
	position: absolute;
	display: none;
	content: '';
        margin-top: 5px;
}


 
.magic-radio:checked + label:after,
.magic-checkbox:checked + label:after {
	display: block;
}
.magic-radio + label:before {
	border-radius: 50%;
}
.magic-radio + label:after {
	top: 6px;
	left: 6px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #3e97eb;
}
.magic-radio:checked + label:before {
	border: 1px solid #3e97eb;
}
.magic-radio:checked[disabled] + label:before {
	border: 1px solid #c9e2f9;
}

.magic-checkbox + label:before {
	border-radius: 3px;
}
.magic-checkbox + label:after {
	top: 2px;
	left: 7px;
	box-sizing: border-box;
	width: 6px;
	height: 12px;
	transform: rotate(45deg);
	border-width: 2px;
	border-style: solid;
	border-color: #fff;
	border-top: 0;
	border-left: 0;
}
.magic-checkbox + label:after {
    top: -2px;
}
.magic-checkbox:checked + label:before {
    border: #1890FF;
    background: #1890FF;
}
.magic-checkbox:checked[disabled] + label:before {
	border: #1890FF;
	background: #1890FF;
}
</style>
<section class="content-header">
    <ol class="breadcrumb">
        <li>统计排名</li>
        <li class="active">查看排名</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">

                <div class="box-tools" style="margin:5px;">
                    <form id="form1" action="{:search_url(['s_time', 'e_time', 'child_show'])}" method="GET" pjax-search="">
                        <div class="input-group input-group-sm">
                            <div style="display: flex;">
                                <a href="{:url('reportset/integral_rank_ranking', ['id'=>input('id'), 'act'=>'y'])}">
                                    <button type="button" class="btn btn-default sreachs">月份排名</button>
                                </a>
                                <a href="{:url('reportset/integral_rank_ranking', ['id'=>input('id'), 'act'=>'j'])}">
                                    <button type="button" class="btn btn-default sreachs">阶段排名</button>
                                </a>
                                <a href="{:url('reportset/integral_rank_ranking', ['id'=>input('id'), 'act'=>'l'])}">
                                    <button type="button" class="btn btn-default sreachs">累计排名</button>
                                </a>
                                {if condition="$act == 'y'"}
                                <input class="timepicker" name="s_time" value="{$s_time}" placeholder="" AUTOCOMPLETE="off">
                                {/if}
                                {if condition="$act == 'j'"}
                                <input class="timepicker" name="s_time" value="{$s_time}" placeholder="" AUTOCOMPLETE="off">
                                <label style="margin-bottom:0;" for="">至</label>
                                <input class="timepicker" name="e_time" value="{$e_time}" placeholder="" AUTOCOMPLETE="off">
                                {/if}
                                <div class="input-group-btn" style="display: inline-block;">
                                    <button type="submit" class="btn btn-default sreachs">
                                        <i class="fa fa-search"></i>查询
                                    </button>
                                </div>
                                  <input type="checkbox" class="magic-checkbox" id="child_show" name="child_show" value="1" {if condition="input('child_show') == 1"}checked{/if}/> <label  class="checkbox-inline" style="margin-left:100px;margin-top:10px;" for="child_show">
                             <span style="margin-left: 10px;"></span>显示子级部门人员</span>  
                                </label>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="box-header with-border">
                    <div class="pull-left">
                        <a href="javascript:xls_explode();" class="btn btn-sm btn-primary"> 导出</a>
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th>排名</th>
                            <th>姓名</th>
                            <th>工号</th>
                            <th>部门</th>
                            <th>分值</th>
                        </tr>
                        {volist name="$user_list" id="v"}
                        <tr>
                            <td>
                                {if condition="$v.level==1"}
                                <img style="width: 25px;" src="__STATIC__/web/the_first.png" alt="">
                                {elseif condition="$v.level==2"}
                                <img style="width: 25px;" src="__STATIC__/web/the_secend.png" alt="">
                                {elseif condition="$v.level==3"}
                                <img style="width: 25px;" src="__STATIC__/web/the_third.png" alt="">
                                {else}
                                {$v.level}
                                {/if}
                            </td>
                            <td>{$v["name"]}</td>
                            <td>{$v["job_number"]}</td>
                            <td>{$department_list[$v["department_id"]]['name']}</td>
                            <td>{:floor($v["integral"])}</td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">

                </div>
            </div>
        </div>
    </div>
</section>
<script>
    $(function(){

        $(".select2").select2({language:"zh-CN"});

        var now = new Date();
        var currentYear=now.getFullYear();
        var startDate = new Date(currentYear,0,1);
        var endDate = new Date(currentYear+1,0,1);
        $('.timepicker').datetimepicker({
            format: "{$timepickerFormat | default='YYYY-MM'}",   //YYYY-MM-DD HH:mm:ss
            locale: moment.locale('zh-cn'),
            // minDate:startDate,
            maxDate : endDate
        });
    });
    function xls_explode() {
        window.location.href = "{:url('Reportset/integral_rank_ranking')}?" + $('#form1').serialize()+"&export=1&id={:input('id')}&act={$act}&child_show={:input('child_show')}";
        return false;
    }
</script>
{/block}
